<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆统计报表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>车辆编号：</label>
                            <input type="text" name="carId"/>
                        </li>
                        <li>
                            <label>车牌号：</label>
                            <input type="text" name="lisenseNum"/>
                        </li>
                        <li>
                            <label>是否查询删除车辆：</label>
                            <select name="delFlag" th:with="type=${@dict.getType('sys_del_flag')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="report:carReport:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var delStatusDatas = [[${@dict.getType('sys_del_flag')}]];
    var prefix = ctx + "report/car";

    $(function() {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "车辆报表",
            columns: [{
                checkbox: false
            },
                {
                    field: 'carId',
                    title: '车辆编号'
                },
                {
                    field: 'lisenseNum',
                    title: '车牌号'
                },
                {
                    field: 'carModel',
                    title: '车辆型号'
                },
                {
                    field: 'rentCount',
                    title: '租车次数'
                },
                {
                    field: 'rentPrice',
                    title: '租车总收入(元)'
                },
                {
                    field: 'damagePrice',
                    title: '损坏总金额(元)'
                },
                {
                    field: 'totalPrice',
                    title: '总收入(元)'
                },
                {
                    field: 'delFlag',
                    title: '车辆是否删除',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(delStatusDatas, value);
                    }
                }
                ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>